<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>HTML-ZMS</title>
    <script>

        function loadfromtxt()
        {

            var httprequest;
            httprequest=new XMLHttpRequest();
            httprequest.onreadystatechange=function()
            {


                if (httprequest.readyState==4 && httprequest.status==200)
                {
                    document.getElementById("myDiv").innerHTML=httprequest.responseText;
                    //   document.getElementById("myDiv").innerHTML=httprequest.responseXML;

                }
                else
                    document.getElementById("myDiv").innerHTML="没拿到";
            }

            /*    httprequest.open("GET","../servlet/First1?myname=名字哦",true);
             httprequest.send(); */

            httprequest.open("POST","../servlet/First1",true);
            //post方式，这里必须写header
            httprequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
            httprequest.send("myname=我今年32岁了");
        }

    </script>

</head>

<body>

<input type="button" value="更新数据" onclick="loadfromtxt()">

<div id="myDiv">f</div>
</body>
</html>
